<?php defined('_JEXEC') or die('Restricted access'); ?>
<?php
$makepay->text          = "PAGE_MAKE_ADHOC_PAY";
$makepay->link          = "index.php?option=com_articlecashrewards&controller=awards&task=adhoc";
$pages[]                = $makepay;

$listadhoc->text        = "PAGE_LIST_ADHOC_PAYMENTS";
$listadhoc->link        = "index.php?option=com_articlecashrewards&controller=awards&task=list";
$pages[]                = $listadhoc;

$managetypes->text      = "PAGE_MANAGE_AWARD_TYPES";
$managetypes->link      = "index.php?option=com_articlecashrewards&controller=awards&task=manage";
$pages[]                = $managetypes;
?>
<form action="index.php?option=com_articlecashrewards" method="post" name="adminForm">
<?php defined('_JEXEC') or die('Restricted access'); ?>
<table class="adminlist" cellspacing="1">
    <tr>
        <td valign="top" width="20%">
            <table width="100%" cellpadding="0" cellspacing="0">
                <tr>
                    <td align="right">
                        <div style="float: left;"><h2><?php echo JText::_("CPANEL_ADHOC")?></h2></div>
                    </td>
                    <td>
                        <div style="float: right;"><img src="components/com_articlecashrewards/assets/images/icon-48-acr-48.png"></div>
                    </td>
                </tr>
                <tr>
                    <td width="100%" colspan="2">
                        <div class="acrsubmenu">
                        <?php
                            foreach($pages as $page){?>
                                <a href="<?php echo $page->link ?>" class="acrlinkblock">
                                    <?php echo JText::_($page->text); ?>
                                </a><?php
                            }
                        ?>
                        </div>
                    </td>
                </tr>
            </table>
        </td>
        <td valign="top">
            <table class="adminlist" cellspacing="1">
                <thead>
                    <tr>
                        <th width="5">
                            <?php echo JText::_( 'Num' ); ?>
                        </th>
                        <th width="20">
                            <input type="checkbox" name="toggle" value="" onclick="checkAll(<?php echo count( $this->rows ); ?>);" />
                        </th>
                        <th class="title">
                            <?php echo JHTML::_('grid.sort', JText::_('LABEL_AUTHOR'), 'u.name', @$lists['order_Dir'], @$lists['order'] ); ?>
                        </th>
                        <th width="20%" class="title">
                            <?php echo JHTML::_('grid.sort', JText::_('LABEL_PAYMENT_TYPE'), 't.description', @$lists['order_Dir'], @$lists['order'] ); ?>
                        </th>
                        <th width="10%" class="title">
                            <?php echo JHTML::_('grid.sort', JText::_('LABEL_AMOUNT'), 'a.amount', @$lists['order_Dir'], @$lists['order'] ); ?>
                        </th>
                        <th width="20%" class="title">
                            <?php echo JHTML::_('grid.sort', JText::_('LABEL_DESCRIPTION'), 'a.description', @$lists['order_Dir'], @$lists['order'] ); ?>
                        </th>
                        <th width="15%" class="title">
                            <?php echo JHTML::_('grid.sort', JText::_('LABEL_PAY_DATE'), 'a.pay_date', @$lists['order_Dir'], @$lists['order'] ); ?>
                        </th>
                        <th width="10%" class="title">
                            <?php echo JHTML::_('grid.sort', JText::_('LABEL_PAID_BY'), 'a.admin_uid', @$lists['order_Dir'], @$lists['order'] ); ?>
                        </th>
                    </tr>
                </thead>
                <tbody>
                    <?php
                    if($this->rows){

                        $k = 0;
                        $i = 0;
                        $user =& JFactory::getUser();
                        foreach ($this->rows as $row){
                            $checked 	= JHTML::_('grid.checkedout',   $row, $i );
                            $link = "index.php?option=com_articlecashrewards&controller=awards&task=adhoc&payid=" . $row->id;
                            ?>
                            <tr class="<?php echo "row$k"; ?>">
                                <td align="left">
                                    <?php echo $this->pagination->getRowOffset( $i); ?>
                                </td>
                                <td align="left">
                                    <?php echo $checked; ?>
                                </td>
                                <td align="left">
                                    <a href="<?php echo $link; ?>" title="<?php echo JText::_('TOOLTIP_EDIT');?>">
                                        <?php echo $row->author; ?>
                                    </a>
                                </td>
                                <td align="left">
                                    <?php echo $row->type; ?>
                                </td>
                                <td align="left">
                                    <?php echo $row->amount; ?>
                                </td>
                                <td align="left">
                                    <?php echo $row->description; ?>
                                </td>
                                <td align="left">
                                    <?php echo $row->pay_date; ?>
                                </td>
                                <td align="left">
                                    <?php echo $row->admin_uid; ?>
                                </td>
                            </tr>
                            <?php
                            $k = 1 - $k;
                            $i++;
                        }
                    }
                    ?>
                </tbody>
                <tfoot>
                    <tr>
                        <td colspan="9"><?php echo $this->pagination->getListFooter(); ?></td>
                    </tr>
                </tfoot>
            </table>
        </td>
    </tr>
</table>
<input type="hidden" name="option" value="com_articlecashrewards" />
<input type="hidden" name="controller" value="awards" />
<input type="hidden" name="task" value="list" />
<input type="hidden" name="pnlimitstart" value="<?php echo $this->pagination->limitstart; ?>" />
<input type="hidden" name="boxchecked" value="0" />
<input type="hidden" name="filter_order" value="<?php echo $this->lists['order']; ?>" />
<input type="hidden" name="filter_order_Dir" value="<?php echo $this->lists['order_Dir']; ?>" />
<?php echo JHTML::_( 'form.token' ); ?>
</form>
